package com.huixiaodian.cus_service.view.activity;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.splashscreen.SplashScreen;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;

import com.huixiaodian.baselibrary.common.Config;
import com.huixiaodian.baselibrary.ft_user.service.impl.LoginImpl;
import com.huixiaodian.baselibrary.utils.SharedPreferencesUtil;
import com.huixiaodian.cus_service.R;

public class LauncherActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        SplashScreen splashScreen = SplashScreen.installSplashScreen(this);
        setContentView(R.layout.activity_splash);
        new Handler().postDelayed(this::startApp, 3000);
    }

    private void startApp() {
        SharedPreferencesUtil sharedPreferencesUtil = SharedPreferencesUtil.getInstance(this);
        boolean isLogin = sharedPreferencesUtil.isBoolean(Config.isLogin, false);
        if (isLogin) {
            startActivity(new Intent(this, MainActivity.class));
        }else{
            LoginImpl.getInstance().startLoginActivity(this);
        }
    }


}